﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
</head>
<body>

    <div>1</div>
    <div>1</div>
    <div>1</div>
    <span>2</span>
    <span>2</span>
    <span>2</span>
    <span>2</span>
    <script>
        var greet = function (name) {
            return 'hi:' + name
        }
        var exclaim = function (statement) {
            return statement.toUpperCase() + '!'
        }
        var compose = function (greet, exclaim) {
            return function (name) {
                console.log(exclaim(greet(name)).replace(/(\w+:)/, function ($1) {
                    return $1.toLowerCase()
                }))
            }
        }

        var welcome = compose(greet, exclaim)
        welcome('dot');



        var wizards = [
            {
                name: 'Harry Potter',
                house: 'Gryfindor'
            },
            {
                name: 'Cedric Diggory',
                house: 'Hufflepuff'
            },
            {
                name: 'Tonks',
                house: 'Hufflepuff'
            },
            {
                name: 'Ronald Weasley',
                house: 'Gryfindor'
            },
            {
                name: 'Hermione Granger',
                house: 'Gryfindor'
            }
        ];

        var hufflepuff = wizards.reduce(function (newArr, wizard) {
            if (wizard.house === 'Hufflepuff') {
                newArr.push(wizard.name);
            }
            return newArr;
        }, []);
        console.log(11);
    </script>


</body>
</html>
